package com.wang.controller;

import com.wang.param.PostCollectionQueryParam;
import com.wang.reponse.PostVo;
import com.wang.reponse.StatisticsVo;
import com.wang.result.BaseResponse;
import com.wang.result.ResultUtils;
import com.wang.user.service.PostService;
import com.wang.user.service.ShopService;
import com.wang.user.service.user.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/statistics")
@Api(tags = "管理员统计信息")
public class AdminController {

    @Resource
    private UserService userService;

    @Resource
    private PostService postService;

    @Resource
    private ShopService shopService;


    @GetMapping("/count")
    @ApiOperation(value = "统计数量信息 用户 帖子 商户")
    public BaseResponse<StatisticsVo> count(PostCollectionQueryParam queryParam) {
        StatisticsVo statisticsVo = new StatisticsVo();
        statisticsVo.setUserCount(userService.count());
        statisticsVo.setPostCount(postService.count());
        statisticsVo.setShopCount(shopService.count());
        return ResultUtils.success(statisticsVo);
    }
}
